package com.dosin.crowno.service;

import com.dosin.crowno.utils.FileWriteAndRead;
import com.dosin.crowno.utils.SSLinitialize;
/*import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.Select;*/
import org.springframework.stereotype.Service;

import javax.xml.xpath.XPath;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;

@Service
public class MainService {
/*

    static WebDriver driver = null;

    static void init() {

        //java.net.CookieHandler.getDefault().get(url)
        //java.net.CookieHandler.getDefault().get(uri, headers);
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--ignore-certificate-errors","blink-settings=imagesEnabled=false");
        SSLinitialize.initialize();
        System.setProperty("webdriver.chrome.driver", "src/main/resources/chrome/chromedriver.exe");
        driver = new ChromeDriver(options);

  */
/*

chrome_options.add_argument('--no-sandbox')#解决DevToolsActivePort文件不存在的报错

chrome_options.add_argument('window-size=1920x3000') #指定浏览器分辨率
chrome_options.add_argument('--disable-gpu') #谷歌文档提到需要加上这个属性来规避bug
chrome_options.add_argument('--hide-scrollbars') #隐藏滚动条, 应对一些特殊页面
chrome_options.add_argument('blink-settings=imagesEnabled=false') #不加载图片, 提升速度
chrome_options.add_argument('--headless') #浏览器不提供可视化页面. linux下如果系统不支持可视化不加这条会启动失败

   *//*



    }

    static void getUrl(String url) {
        init();
       // String url2 = url;
        driver.get(url);
    }

    static void sleeping(){
        try {
            Thread.sleep(30000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }




    public void loginWebSite(String website, String username, String passwd, String level, String safetyCode,String cookieStr) {

            init();
            getUrl(website);

        //获取cookie，上面一跳出循环我认为就登录成功了，当然上面的判断不太严格，可以再进行修改
        Set<Cookie> cookiess = driver.manage().getCookies();
        for (Cookie cookie : cookiess) {
            cookieStr += cookie.getName() + "=" + cookie.getValue() + "; ";
        }
        System.out.println("看看情况o："+cookiess.toString());


        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);





        //driver.findElement(By.id("proceed-link")).click();
        driver.findElement(By.id("btn_C")).click();
        driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
        driver.findElement(By.id("username")).sendKeys(username);
        driver.findElement(By.id("pwd")).sendKeys(passwd);
        driver.findElement(By.id("loginBtn")).click();


        //获取cookie，上面一跳出循环我认为就登录成功了，当然上面的判断不太严格，可以再进行修改
        Set<Cookie> cookies = driver.manage().getCookies();
        for (Cookie cookie : cookies) {
            cookieStr += cookie.getName() + "=" + cookie.getValue() + "; ";
        }
        System.out.println("看看情况："+cookies.toString());

       // System.out.println("看看情况1："+cookieStr);




        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);




        String parentWindowHandler = driver.getWindowHandle(); // Store your parent window

        String subWindowHandler = null;



        Set<String> handles = driver.getWindowHandles(); // get all window handles

        Iterator<String> iterator = handles.iterator();

        while (iterator.hasNext()){

            subWindowHandler = iterator.next();

        }

        driver.switchTo().window(subWindowHandler); // switch to popup window



        // Now you are in the popup window, perform necessary actions here



        driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

        driver.findElement(By.xpath("//ul[@id='ul_show']/li")).getText();
        System.out.println(driver.findElement(By.xpath("//ul[@id='ul_show']/li")).getText());
                //# driver.find_element_by_xpath("//div[@id='s-top-left']/a[2]").click()



        driver.findElement(By.id("anno_ok_btn")).click();
        driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
        driver.switchTo().window(parentWindowHandler);  // switch back to parent window
        //.getTagName();
        driver.findElement(By.className("da_report_btn")).click();

        WebElement mySelectElm = driver.findElement(By.id("result_type_div_600"));
        Select mySelect= new Select(mySelectElm);
        mySelect.selectByValue("N");
        //mySelect.selectByValue("Y");
        driver.findElement(By.id("input_start")).sendKeys("2021-06-19");
        driver.findElement(By.id("input_end")).sendKeys("2021-06-19");

        WebElement mySelectElm1 = driver.findElement(By.id("date_div_600"));
        Select mySelect1= new Select(mySelectElm1);
        mySelect1.selectByValue("to");
       // mySelect1.selectByValue("yes");

        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
        driver.findElement(By.id("search_btn")).click();
        driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);



       // result_type_div_600
        //FT_today
*/
/*        driver.findElement(By.id("FT_today")).click();
        driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
        //league_name
        driver.findElement(By.id("league_name")).getText();
        System.out.println(driver.findElement(By.id("league_name")).getSize());
        System.out.println(driver.findElement(By.id("league_name")).getText());*//*



        //https://ag.hga008.com/transform.php?login_layer=ag&uid=bc80145m7539747l294568856xw&langx=zh-cn&ver=version-7-31&p=get_league_wager&session=FT&gtype=FT&date=&market=&gold=0&percentage=full&down_id=all&league_id=all&filter=Y&symbol=more


        */
/*

        WebDriverWait wait = new WebDriverWait(driver, 20);
        wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(".red_box")));
        WebElement element = driver.findElement(By.cssSelector(".red_box"));
        ((JavascriptExecutor)driver).executeScript("arguments[0].style.border = \"5px solid yellow\"",element);
         *//*



        Set<Cookie> cookiessxs = driver.manage().getCookies();
        for (Cookie cookie : cookiessxs) {
            cookieStr += cookie.getName() + "=" + cookie.getValue() + "; ";
        }
        System.out.println( "看看信息:"+driver.manage().toString());
        System.out.println("看看情况："+cookiessxs.toString());

        System.out.println("保存cookies成功："+cookieStr);


       // List<WebElement> elements = driver.findElements(By.name("user_btn"));
        //int number=elements.size();
        //System.out.println(number);

        //System.out.println(elements.toString());
        //user_btn
        //driver.findElement(By.xpath("//*[@id='re_body_scroll']/div/table/tbody/tr/td[1]/div/div")).getText();

        System.out.println("看看td的个数："+driver.findElements(By.xpath("/html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td")).size());

        int td = Integer.parseInt(String.valueOf(driver.findElements(By.xpath("/html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td")).size()));

        if(td != 0) {

            System.out.println("全路径：" + driver.findElement(By.xpath("/html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/div/div")).getText());
            ///html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/div/div
            driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);

            //driver.findElement(By.xpath("//*[@id='re_body_scroll']/div/table/tbody/tr/td[1]/div/div")).click();
            driver.findElement(By.xpath("/html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/div/div")).click();
            //*[@id="re_body_scroll"]/div/table/tbody/tr/td[1]/div/div
            driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

            //driver.findElement(By.xpath("/html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/div/div")).click();

            List<WebElement> elements = driver.findElements(By.tagName("div"));
*/
/*                                                                /html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/div/div
                                                                  /html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[2]/td[1]/div/div
                                                                  /html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[3]/td[1]/div/div*//*


            // By.xpath( "//*[text()='请选择']")
            ///html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/div/div

            //下注金额 /html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[3]
            System.out.println("看看子目录的个数:" + elements.size());

            int countx = 0;

            for (int x = 0; x < elements.size(); x++) {

               // if (elements.get(x).getAttribute("name").equals("user_btn")) {
                    System.out.println("第" + x + "个，标签内容： " + elements.get(x).getText() + "标签名：" + elements.get(x).getTagName()
                            + " 属性名：" + elements.get(x).getAttribute("name"));
                    countx++;
                    System.out.println(countx);
                //}

            }
            String count = driver.findElement(By.xpath("/html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[2]")).getText();
            //单用户下注笔数
            //总下注笔数 /html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[2]
            System.out.println("某用户下注笔数：" + count);

            ////html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[2]
            // driver.findElement(By.xpath("/html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/div/div")).click();
            ///html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/div/div
            ///html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[2]/td[1]/div/div
*/
/*        for(int i=0;i<elements.size();i++){

            driver.findElement(By.xpath("/html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[i]/td[1]/div/div")).click();

        }*//*

            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            driver.manage().timeouts().implicitlyWait(45, TimeUnit.SECONDS);
            //*[@id="re_body_scroll"]/div/table/tbody/tr[1]/td[1]/div/div
            driver.findElement(By.xpath("/html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/div/div")).click();
            ///html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/div/div
            ///html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/div/div
            ///html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[2]/td[1]/div/div
            ///html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/div/div
            ///html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/div/div
            ///html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[2]/td[1]/div/div
            ///html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[3]/td[1]/div/div

            String user = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/div/div")).getText();


            ///html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/div/div
            ///html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/div/div
*/
/*        String datetime = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[1]")).getText();
        String classes = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[2]")).getText();
        String name = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[4]")).getText();
        String duiwu = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[5]")).getText();
        String bifen = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[5]/tt[1]")).getText();
        String bifen2 = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[5]/tt[2]")).getText();
        String bifen3 = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[5]/tt[3]")).getText();
        String duiwu2 = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[6]")).getText();
        String bifen4 = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[6]/tt[1]")).getText();
        String bifen5 = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[6]/tt[2]")).getText();

        String gunqiu = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[7]")).getText();
        String xiazhujine = driver.findElement(By.xpath("/html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[2]")).getText();*//*



            for (int i = 1; i <= Integer.parseInt(count); i++) {
                String datetime = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[1]")).getText();
                String classes = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[2]")).getText();
                String name = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[4]")).getText();
                String duiwu = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[5]")).getText();
                String bifen = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[5]/tt[1]")).getText();
                String bifen2 = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[5]/tt[2]")).getText();
                String bifen3 = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[5]/tt[3]")).getText();
                String duiwu2 = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[6]")).getText();
                String bifen4 = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[6]/tt[1]")).getText();
                String bifen5 = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[6]/tt[2]")).getText();

                String gunqiu = driver.findElement(By.xpath("/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[7]")).getText();
                String xiazhujine = driver.findElement(By.xpath("/html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[2]")).getText();


                System.out.println("下注用户：" + user);
                System.out.println("比赛时间：" + datetime);
                System.out.println("比赛种类：" + classes);
                System.out.println("比赛名称：" + name);
                System.out.println("比赛队伍：" + duiwu);
                System.out.println("比赛比分：" + bifen + " " + bifen2 + " " + bifen3);
                System.out.println("下半场比赛队伍：" + duiwu2);
                System.out.println("下半场比赛比分：" + bifen4 + " " + bifen5);
                System.out.println("是否滚球让球：" + gunqiu);
                System.out.println("下注金额：" + xiazhujine);
            }

            //子子目录

            //  下注时间/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/ul/li[1]

            ///下注种类/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/ul/li[2]
            ///赛事名称/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/ul/li[4]
            ///比赛队伍：/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/ul/li[5]
            // 比分：/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/ul/li[5]/tt[1]
            ///比分2：/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/ul/li[5]/tt[2]
            ///比分3：/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/ul/li[5]/tt[3]

            ////html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/ul/li[6]/tt[1]
            ///html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/ul/li[6]/tt[2]


            ///html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/ul/li[6]
            ////html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/ul/li[6]/tt[1]
            ///html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/ul/li[6]/tt[2]

            ///滚球让球/html/body/div[1]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr/td[1]/ul/li[7]

            ///下注金额：/html/body/div[1]/div[1]/div[3]/div[2]/div/div/ul[4]/li[1]/span[1]/tt


            ///html/body/div/div[1]/div[1]/div[2]/div/div[2]/div[2]/div/table/tbody/tr[1]/td[1]/ul/li[2]
            //*[@id="tid_13748033141"]/td[1]/ul/li[2]

            //*[@id="tid_13748033141"]/td[1]/ul/li[4]


            //*[@id="wager_show"]/h1/div
            // /html/body/div/div[1]/div[3]/div[2]/h1/div/


            //*[@id="tid_13748057963"]/td[1]/ul/li[4]


            //driver.findElement(By.name("user_btn")).click();
        }else{
            System.out.println(driver.findElement(By.xpath("/html/body/div/div[1]/div[1]/div[2]/div/div[7]")).getText());
        }

        sleeping();

    }



    public void loginWebSite1(String website, String username, String passwd, String level, String safetyCode,String cookieStr) {

        init();
        getUrl(website);


        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);



        //driver.findElement(By.id("proceed-link")).click();
        //driver.findElement(By.id("btn_C")).click();
        //driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
        driver.findElement(By.id("usr")).sendKeys(username);
        driver.findElement(By.id("pwd")).sendKeys(passwd);
        driver.findElement(By.id("btn_login")).click();
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);








        try {

            //不停的检测，一旦当前页面URL不是登录页面URL，就说明浏览器已经进行了跳转
            while (true) {
                Thread.sleep(500L);
                if (!driver.getCurrentUrl().startsWith("https://hga030.com/")) {
                    break;
                }
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        //获取cookie，上面一跳出循环我认为就登录成功了，当然上面的判断不太严格，可以再进行修改
        Set<Cookie> cookies = driver.manage().getCookies();

        for (Cookie cookie : cookies) {
            cookieStr += cookie.getName() + "=" + cookie.getValue() + "; ";
        }
        System.out.println( "看看信息:"+driver.manage());
        System.out.println("看看情况："+cookies.toString());

        System.out.println("看看情况1："+cookieStr);
        FileWriteAndRead.writeFile("d:/data.txt",cookieStr);

        System.out.println("保存cookies成功："+cookieStr);






*/
/*        driver.findElement(By.className("da_totalbet_btn")).click();
        driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
        //FT_today
        driver.findElement(By.id("FT_today")).click();
        driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
        //league_name
        driver.findElement(By.id("league_name")).getText();
        System.out.println(driver.findElement(By.id("league_name")).getSize());
        System.out.println(driver.findElement(By.id("league_name")).getText());*//*



        //https://ag.hga008.com/transform.php?login_layer=ag&uid=bc80145m7539747l294568856xw&langx=zh-cn&ver=version-7-31&p=get_league_wager&session=FT&gtype=FT&date=&market=&gold=0&percentage=full&down_id=all&league_id=all&filter=Y&symbol=more


        */
/*

        WebDriverWait wait = new WebDriverWait(driver, 20);
        wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(".red_box")));
        WebElement element = driver.findElement(By.cssSelector(".red_box"));
        ((JavascriptExecutor)driver).executeScript("arguments[0].style.border = \"5px solid yellow\"",element);
         *//*

        //sleeping();

    }

*/





}
